package org.example.order.config;

import feign.Logger;
import feign.Retryer;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

/**
 * @Author : wer
 * @Date: 2025/6/21 16:36
 * @Description: 订单服务配置
 */

@Configuration
public class OrderConfig {

    @Bean
    @LoadBalanced // 负载均衡
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }

    // feign日志启用
    @Bean
    Logger.Level feignLoggerLevel() {
        return Logger.Level.FULL;
    }

    // 超时重试
    @Bean
    Retryer feignRetryer() {
        return new Retryer.Default();
    }
}
